# Contributor: Aaron Fischer <mail@aaron-fischer.net>
# Maintainer: Aaron Fischer <mail@aaron-fischer.net>
pkgname=rinetd
pkgver=0.73
pkgrel=0
pkgdesc="TCP/UDP port redirector"
url="https://github.com/samhocevar/rinetd"
arch="all"
license="GPL-2.0-only"
makedepends="
	autoconf
	automake
	"
subpackages="
	$pkgname-doc
	$pkgname-openrc
	"
source="https://github.com/samhocevar/rinetd/releases/download/v$pkgver/rinetd-$pkgver.tar.bz2
	$pkgname.initd
	"

build() {
	./bootstrap
	./configure \
		--prefix=/usr \
		--disable-dependency-tracking \
		--enable-silent-rules
	make
}

check() {
	# There are no tests at the moment, but the makefile includes an empty test
	# target, so we include it here to be prepared when there are tests to execute.
	make test
}

package() {
	# Binary
	install -Dm755 "$pkgname" "$pkgdir/usr/sbin/$pkgname"

	# Configuration
	install -Dm644 "$pkgname.conf" "$pkgdir/etc/$pkgname.conf"
	install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"

	# Documentation
	install -Dm644 "$pkgname.8" "$pkgdir/usr/share/man/man8/$pkgname.8"
	install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
	install -Dm644 index.html "$pkgdir/usr/share/doc/$pkgname/index.html"
	install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

sha512sums="
e5d1c7e5826a75c520453032f6e4651700860505dfced625698fc036249b9f585a894e1fee905321878b2d2a265c843f5a746090311929518594263b33b64ed8  rinetd-0.73.tar.bz2
3243341cec80d67f972961efdfead0ada2de0ea5f9c980040e048d3fef5a95eefd0954321887a460ad45e22db8f70f584d827a9baa8e5d09fcb424fd51fb0949  rinetd.initd
"
